<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/base}">
<body>
<div layout:fragment="content">
    <div class="card">
        <div class="card-body">
            <div class="d-flex justify-content-between align-items-center">
                <h1 class="card-title" th:text="${post.title}">文章标题</h1>
                <div>
                    <a th:href="@{'/post/' + ${post.id} + '/edit'}" class="btn btn-primary me-2">
                        <i class="bi bi-pencil"></i> 编辑
                    </a>
                    <form th:action="@{'/post/' + ${post.id} + '/delete'}" method="post" style="display: inline;">
                        <input type="hidden" name="_method" value="DELETE" />
                        <input type="hidden" th:name="${_csrf?.parameterName}" th:value="${_csrf?.token}" />
                        <button type="submit" class="btn btn-danger" 
                                onclick="return confirm('确定要删除这篇文章吗？');">
                            <i class="bi bi-trash"></i> 删除
                        </button>
                    </form>
                </div>
            </div>
            <p class="text-muted">
                发布于 <span th:text="${#temporals.format(post.createTime, 'yyyy-MM-dd HH:mm')}">时间</span>
            </p>
            <div class="card-text markdown-body" th:utext="${post.content}">
                文章内容
            </div>
        </div>
    </div>
</div>
</body>
</html>